﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ucRegister.ascx.cs" Inherits="UserControl_ucRegister" %>
<%@ Register Assembly="MSCaptcha" Namespace="MSCaptcha" TagPrefix="cc1" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>

<script language="javascript" type="text/javascript">
    function UpdateParentsLogin() {
        tb_remove();
        window.parent.location = "Error.aspx";
    }
</script>

<script type="text/javascript">
    function ValidateChecked(sender, args) {
        if ($('#<%= chkAccept.ClientID %>').attr('checked')) {
            $('#tdCheckboxAgree').removeClass("checkReq");
        }
        else {
            $('#tdCheckboxAgree').removeClass("checkReq");
            $('#tdCheckboxAgree').addClass("checkReq");
            args.IsValid = false;
        }
    }    
</script>

<style type="text/css">
    .checkReq
    {
        border: solid 1px black;
        background-color: #2187D9;
    }
</style>
<asp:UpdatePanel ID="updatePnlReg" runat="server">
    <ContentTemplate>
        <table width="100%" border="0" cellpadding="0" cellspacing="0">
            <tr>
                <td align="center" style="padding-bottom: 5px; padding-top: 5px">
                    <asp:Label ID="lblMessage" runat="server" Text="">
                    </asp:Label>
                </td>
            </tr>
        </table>
        <asp:Panel ID="pnlRegister" runat="server" DefaultButton="cmdSubmit">
            <table>
                <tr>
                    <td style="padding: 5px 5px 10px 10px;" align="center">
                        <table border="0" cellpadding="0" cellspacing="0" width="100%">
                            <tr>
                                <td style="font-size: 14px;">
                                    <b>Đăng ký thành viên ii-online là miễn phí.</b>
                                    <br />
                                    Khi bạn đăng ký, bạn có thể sử dụng các chức năng quản ký người dùng của trang web
                                    để theo dõi các đơn đặt hàng của bạn cũng như xem lịch sử mua...
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td class="clsRegisterTitle">
                       Thông Tin Cá Nhân
                    </td>
                </tr>
                <tr>
                    <td style="padding: 5px 7px 5px 15px; text-align: left;">
                        <table border="0" cellpadding="0" cellspacing="3">
                            <tr>
                                <td align="right">
                                    Email:
                                </td>
                                <td align="left">
                                    <asp:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender1" runat="server" TargetControlID="txtEmail"
                                        WatermarkCssClass="clsWaterMarkRequiredField" WatermarkText="email@user.com">
                                    </asp:TextBoxWatermarkExtender>
                                    <asp:TextBox ID="txtEmail" runat="server" ValidationGroup="validRegister" ToolTip="Input email"
                                        CssClass="txtRegisterReq" Width="250px"></asp:TextBox>
                                    &nbsp;<asp:RequiredFieldValidator ID="RequiredFieldValidator2" ControlToValidate="txtEmail"
                                        runat="server" ErrorMessage="*" SetFocusOnError="True" Display="Static" ValidationGroup="grpRegister"></asp:RequiredFieldValidator>&nbsp;
                                    <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ErrorMessage="Invalid email address"
                                        Display="Static" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
                                        ControlToValidate="txtEmail" SetFocusOnError="True" ValidationGroup="grpRegister"></asp:RegularExpressionValidator>
                                </td>
                            </tr>
                            <tr>
                                <td align="right">
                                    Mật khẩu:
                                </td>
                                <td>
                                    <asp:TextBox ID="txtPassword" runat="server" TextMode="Password" ToolTip="Input password"
                                        CssClass="txtRegisterReq" Width="250px"></asp:TextBox>
                                    &nbsp;<asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="txtPassword"
                                        runat="server" ErrorMessage="*" Display="Static" ValidationGroup="grpRegister"></asp:RequiredFieldValidator>
                                </td>
                            </tr>
                            <tr>
                                <td align="right">
                                    Nhập lại mật khẩu:
                                </td>
                                <td>
                                    <asp:TextBox ID="txtRePassword" runat="server" TextMode="Password" ToolTip="Retype your password"
                                        CssClass="txtRegisterReq" Width="250px"></asp:TextBox>
                                    &nbsp;<asp:RequiredFieldValidator ID="requireRePassword" ControlToValidate="txtRePassword"
                                        runat="server" ErrorMessage="*" Display="Dynamic" ValidationGroup="grpRegister"></asp:RequiredFieldValidator><asp:CompareValidator
                                            ID="CompareValidator1" runat="server" ErrorMessage="Passwords do not match. "
                                            Display="Dynamic" ControlToCompare="txtPassword" ControlToValidate="txtRePassword"
                                            ValidationGroup="grpRegister"></asp:CompareValidator>
                                </td>
                            </tr>
                            <tr>
                                <td align="right">
                                    Tên:
                                </td>
                                <td>
                                    <asp:TextBox ID="txtFName" runat="server" ValidationGroup="validRegister" CssClass="txtRegisterReq"
                                        Width="250px"></asp:TextBox>
                                    &nbsp;<asp:RequiredFieldValidator ID="requireFirstName" ControlToValidate="txtFName"
                                        runat="server" ErrorMessage="*" Display="Dynamic" ValidationGroup="grpRegister"></asp:RequiredFieldValidator>
                                </td>
                            </tr>
                            <tr>
                                <td align="right" style="width: 230px;">
                                    Họ:
                                </td>
                                <td align="left">
                                    <asp:TextBox ID="txtSName" runat="server" ValidationGroup="validRegister" CssClass="txtRegisterReq"
                                        Width="250px"></asp:TextBox>
                                    &nbsp;<asp:RequiredFieldValidator ID="requireLastName" ControlToValidate="txtSName"
                                        runat="server" ErrorMessage="*" Display="Dynamic" ValidationGroup="grpRegister"></asp:RequiredFieldValidator>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td class="clsRegisterTitle">
                        Xác Minh
                    </td>
                </tr>
                <tr>
                    <td align="center">
                        <table border="0" cellpadding="0" cellspacing="0">
                            <tr>
                                <td>
                                    <asp:UpdatePanel ID="updCap" runat="server">
                                        <ContentTemplate>
                                            <cc1:CaptchaControl ID="msCaptcha" runat="server" BorderWidth="1px" BorderStyle="Solid"
                                                BorderColor="#5daeff" Width="185" FontColor="#007eb3" ForeColor="AliceBlue" NoiseColor="#237ceb"
                                                CaptchaBackgroundNoise="Extreme" CaptchaLength="5" CaptchaHeight="50" CaptchaWidth="185"
                                                CaptchaLineNoise="None" CaptchaMinTimeout="5" CaptchaMaxTimeout="240" LineColor="Yellow"
                                                CaptchaFontWarping="Low" />
                                        </ContentTemplate>
                                    </asp:UpdatePanel>
                                </td>
                                <td valign="top" style="padding-left: 5px;">
                                    <asp:Label ID="lblInputCaptcha" runat="server" Text="Mã xác nhận:" Style="font-size: 12px;"></asp:Label><asp:UpdatePanel
                                        ID="updTxt" runat="server">
                                        <ContentTemplate>
                                            <asp:TextBox ID="txtCaptcha" runat="server" Width="100" CssClass="txtRegisterReq"
                                                autocomplete="off" ToolTip="Mã xác minh"></asp:TextBox>&nbsp;<asp:RequiredFieldValidator
                                                    ID="regCaptcha" runat="server" ErrorMessage="" ToolTip="Nhap ma xác minh."
                                                    ForeColor="Red" ControlToValidate="txtCaptcha" SetFocusOnError="true" Text="*"
                                                    ValidationGroup="grpRegister"></asp:RequiredFieldValidator></ContentTemplate>
                                        <Triggers>
                                            <asp:AsyncPostBackTrigger ControlID="lnkRefreshCaptcha" EventName="Click" />
                                        </Triggers>
                                    </asp:UpdatePanel>
                                    <asp:LinkButton ID="lnkRefreshCaptcha" runat="server" Text="Cập nhật mã xác minh" CausesValidation="false"
                                        Style="font-size: 12px;" OnClick="lnkRefreshCaptcha_Click"></asp:LinkButton>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td class="clsRegisterTitle">
                        Hiệp Định
                    </td>
                </tr>
                <tr>
                    <td style="padding: 5px 7px 5px 7px; text-align: left;">
                        <table border="0" cellpadding="0" cellspacing="3" width="100%">
                            <tr>
                                <td id="tdCheckboxAgree" class="loginLnk">
                                    <asp:CheckBox ID="chkAccept" runat="server" />
                                    Tôi chấp nhận
                                    <asp:HyperLink ID="lnkPolicy" runat="server" NavigateUrl="~/PrivacyPolicy .aspx">chính sách bảo mật</asp:HyperLink>
                                    <asp:CustomValidator ClientValidationFunction="ValidateChecked" runat="server" ID="valchkAccept"
                                        ValidationGroup="grpRegister" />
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:CheckBox ID="chkNewsletter" runat="server" Checked="true" />
                                    Đăng ký bản tin trực tuyến trên ii-online .
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td align="center" style="padding-top: 10px;">
                        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                            <ContentTemplate>
                                <asp:ImageButton ID="cmdSubmit" runat="server" ToolTip="Register" ImageUrl="~/images/bt_register.png"
                                    OnClick="cmdSubmit_Click" ValidationGroup="grpRegister" />
                            </ContentTemplate>
                            <Triggers>
                                <asp:AsyncPostBackTrigger ControlID="cmdSubmit" EventName="Click" />
                            </Triggers>
                        </asp:UpdatePanel>
                    </td>
                </tr>
                <tr>
                    <td align="center" style="padding-top: 5px;">
                        <asp:UpdateProgress ID="UpdateProgress1" runat="server">
                            <ProgressTemplate>
                                <asp:Image ID="imgLoading" runat="server" ToolTip="Loading..." ImageUrl="~/images/loadingAnimation.gif"
                                    Style="border-width: 0px;" Width="31px" />
                            </ProgressTemplate>
                        </asp:UpdateProgress>
                    </td>
                </tr>
            </table>
        </asp:Panel>
    </ContentTemplate>
</asp:UpdatePanel>
